{include file="public_head"}
{include file="public_menu"}
  <div class="category_goods">
    <div class="content">
      <div class="category_list">
        <div class="left">分类</div>
        <ul class="left">
          {volist name="cates" id="item"}
          <li><a href="{:url('goods_type/index',['type' => $item.id,'level' => input('level')])}">{$item.title}</a></li>
          {/volist}
        </ul>
      </div>
      <div class="main">
        <div class="left_main left">
          <div class="title">商品精选</div>
          <ul>
            {volist name="guess_like" id="item" length="8"}
            <li>
              <a href="{:url('ShopGoods/index',['good_id'=>$item.id])}">
                <img src="/{$item.thumb_img}" class="pic">
                <div class="price">￥{$item.price}</div>
                <div class="name">{$item.title|reStrLen=###,24}</div>
                <div class="num">已有<span>{$item.evaluate_number}</span>人评价</div>
              </a>
            </li>
            {/volist}
          </ul>

        </div>
        <div class="right_main right" style="min-height: 2274px;">
          <div class="shop_left_list">
            <ul class="left">
              <li {eq name=":input('order')" value="" }class="active"{/eq} onclick="set_sort('');">综合</li>
              <li {eq name=":input('order')" value="sale_number" }class="active"{/eq} onclick="set_sort('sale_number');">销量</li>
              <li {eq name=":input('order')" value="hits" }class="active"{/eq} onclick="set_sort('hits');">点击</li>
              <li {eq name=":input('order')" value="create_time" }class="active"{/eq} onclick="set_sort('create_time');">新品</li>
              <li {eq name=":input('order')" value="price" }class="active"{/eq} onclick="set_sort('price');">价格</li>
            </ul>
            <!--<div class="input_price left">-->
              <!--<input type="text" placeholder="￥" id="low_price" value="{:input('low')}">-->
              <!--<label>-</label>-->
              <!--<input type="text" placeholder="￥" id="high_price" value="{:input('high')}">-->
            <!--</div>-->
            <!--<label><a href="javascript:search();">确定</a></label>-->
            <div class="right">共<span style="color:#E01222;">{$total}+</span>件商品</div>
            <!--<div class="pages" style="margin-top: 100px;">{$data->render();}</div>-->
          </div>
          <ul class="list-item">
            {volist name="data" id="vo"}
            <li>
              <a href="{:url('ShopGoods/index',['good_id'=>$vo.id])}">
                <img src="/{$vo.thumb_img}" class="pic">
                <div class="price">￥{$vo.price}</div>
                <div class="goods">{$vo.title|reStrLen=###,38}</div>
                <div class="num">已有<span>{$vo.evaluate_number}+</span>条评价</div>
                <div class="shop-name">{$vo.shop.title}</div>
                <div class="buy">立即购买</div>
              </a>
            </li>
            {/volist}
          </ul>
        </div>
        <input type="hidden" id="type" value="{:input('type')}">
        <input type="hidden" id="order" value="{:input('order')}">
        <div class="pages" style="margin-top: 100px;">{$data->render();}</div>
      </div>
    </div>
  </div>
<script>
  //    商品分类
  function set_cate(parameter) {
    var shop_id = $('#shop_id').val();
    var order = $('#order').val();
    var low = $('#low_price').val();
    var high = $('#high_price').val();
    $('#type').val(parameter);

    var url = "{:url('shop/goods_type/index')}?type="+parameter+'&order='+order;
    window.location.href=url;
  }
  //商品排序
  function set_sort(parameter) {
    var shop_id = $('#shop_id').val();
    var parent_id = $('#type').val();
    var low = $('#low_price').val();
    var high = $('#high_price').val();
//    var title = $('#title').val();

    $('#order').val(parameter);
    var url = "{:url('shop/goods_type/index')}?type="+parent_id+'&order='+parameter;
    window.location.href=url;

  }
  // 关键字搜索
  function search() {
    var shop_id = $('#shop_id').val();
    var order = $('#order').val();
    var parent_id = $('#type').val();
    var low = $('#low_price').val();
    var high = $('#high_price').val();

    if (low!=''&&high!='') {
      var url = "{:url('shop/goods_type/index')}?type="+parent_id+'&order='+order;
    }else {
      var url = "{:url('shop/goods_type/index')}?type="+parent_id+'&order='+order+"&low="+low+"high="+high;
    }

    window.location.href=url;

  }

  // 加入购物车
  function in_cart(id){
    var num = $('#num').val(),
        attr = $('#text_selected').text(),
        price = $('#default_price').val(),
        shop_id = $('#shop_id').val();
    $.ajax({
      url:"{:url('shop/shop_cart/default_cart')}",
      type:'post',
      dateType:'json',
      data:{'id':id,'attr':attr,'num':num,'price':price,'shop_id':shop_id},
      success:function (t) {
        if (t.code == 200){
          layer.msg(t.message);
        }else if (t.code == 401){   //未登录
          layer.msg(t.message);
        }else{
          layer.msg(t.message);
        }
      }
    })
  }

  $("a").bind("focus",function() {
    if(this.blur) {this.blur()};
  });

</script>
{include file="public_foot"}